package com.aw.manual.ejemplo016;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

/**
 * User: gmc
 * Date: 07/06/2010
 */
@Component
public class Acelerador {
    int velocidadActual = 0;
    @Autowired
    ApplicationEventPublisher applicationEventPublisher;

    public void setearVelocidad(int velocidad){
        this.velocidadActual = velocidad;
        applicationEventPublisher.publishEvent(new CambioDeVelocidadEvento(this));
    }

    public int getVelocidadActual() {
        return velocidadActual;
    }
}
